Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactoring of ThermalGrid.handleInfeed to fix thermal storage recharge correctly when empty #931

Open
wants to merge 105 commits into
base: dev
Choose a base branch
from

Conversation

danielfeismann
Copy link
Member

@danielfeismann danielfeismann commented Aug 24, 2024

resolves #930

merge #1052 and #1046 first

…neState-of-ThermalHouse' into df/tmpHPmergeall
…ageResults-have-multiple-entries' into df/tmpHPmergeall

# Conflicts:
#	CHANGELOG.md
…ion-of-Hp-when-not-under-control-of-an-EM' into df/tmpHPmergeall

# Conflicts:
#	CHANGELOG.md
…ermalGird-energyDemand' into df/tmpHPmergeall
@danielfeismann danielfeismann self-assigned this Aug 24, 2024
@danielfeismann danielfeismann added the bug Something isn't working label Aug 24, 2024
danielfeismann and others added 17 commits August 29, 2024 14:40
# Conflicts:
#	CHANGELOG.md
#	src/main/scala/edu/ie3/simona/model/thermal/ThermalGrid.scala
# Conflicts:
#	CHANGELOG.md
#	src/main/scala/edu/ie3/simona/model/thermal/ThermalGrid.scala
@danielfeismann danielfeismann marked this pull request as ready for review November 14, 2024 14:18
Copy link
Member

@sebastian-peter sebastian-peter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some first questions from my side.

Comment on lines +239 to +246
(zeroKW, lastStateStorageQDot * (-1))
else if (
lastStateStorageQDot == zeroKW && (demandWrapper.houseDemand.hasRequiredDemand || demandWrapper.heatStorageDemand.hasRequiredDemand)
)
(
zeroKW,
thermalGrid.storage.map(_.getChargingPower: squants.Power).get,
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would love some help understanding what is being done here. Maybe we could enhance the overall code documentation here? To someone who knows the implementation well, these probably seem trivial, but for the untrained eye they're maybe not. For example:

  • There's multiple thermal powers, but they're not clearly defined. In HpState, is qDot the combined thermal power including storage, or just the heat pump, or just storage?
  • Does qDot in the house state include the heat loss of the building, or just infeed by the grid?
  • What does it mean if the storage has "required demand"? Maybe one could argue that storage demand is always somewhat optional.
  • I suppose positive charging power of the storage means charging, negative means discharging? Would love to have this documented
  • Generally, the selected piece of code here could maybe be commented a bit, i.e. why is each case doing what it is doing?

Those are just some things that "jumped" at me...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right! Even after some time understanding what happens here get's hard, to be honest...

Regarding your questions:

  • qDot of HpState is just the qDot from the Hp.
  • qDot in the house state includes only the infeed (from grid or from storage), losses comes separate since they depending also from temperature difference.
  • imho: storage has required demand if they are empty. They're having additionalDemand unless they're full.
  • please see here but I will add it to the other scalaDocs whenever it makes sense...
  • Agreed. Let's see if I can make it easier to understand.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

partsly the interpretation of required and additional demand is handled here. Which we might merge before. #918

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Refactor ThermalGrid.handleInfeed
4 participants